namespace YMJake.Flowable.ExternalWorker.Client.Core.Client;

/// <summary>
/// Base interface for external worker jobs
/// </summary>
public interface IExternalWorkerJob
{
    /// <summary>
    /// Returns the unique identifier for this job
    /// </summary>
    string Id { get; }

    /// <summary>
    /// Returns the correlation id of a job.
    /// The same job can be moved around and have its technical id changed.
    /// This id allows tracking that job.
    /// </summary>
    string? CorrelationId { get; }

    /// <summary>
    /// Returns the number of retries this job has left. 
    /// Whenever the job executor fails to execute the job, this value is decremented.
    /// When it hits zero, the job is supposed to be dead and not retried again.
    /// </summary>
    int Retries { get; }

    /// <summary>
    /// Returns the date on which this job is supposed to be processed
    /// </summary>
    DateTime? DueDate { get; }

    /// <summary>
    /// Returns the message of the exception that occurred, the last time the job was executed.
    /// Returns null when no exception occurred.
    /// </summary>
    string? ExceptionMessage { get; }

    /// <summary>
    /// Get the tenant identifier for this job
    /// </summary>
    string? TenantId { get; }

    /// <summary>
    /// Reference to an element identifier or null if none is set
    /// </summary>
    string? ElementId { get; }

    /// <summary>
    /// Reference to an element name or null if none is set
    /// </summary>
    string? ElementName { get; }

    /// <summary>
    /// Reference to a scope identifier or null if none is set
    /// </summary>
    string? ScopeId { get; }

    /// <summary>
    /// Reference to a sub scope identifier or null if none is set
    /// </summary>
    string? SubScopeId { get; }

    /// <summary>
    /// Reference to a scope type or null if none is set
    /// </summary>
    string? ScopeType { get; }

    /// <summary>
    /// Reference to a scope definition identifier or null if none is set
    /// </summary>
    string? ScopeDefinitionId { get; }

    /// <summary>
    /// Returns the creation datetime of the job
    /// </summary>
    DateTime? CreateTime { get; }

    /// <summary>
    /// The id of the worker that has the lock on the job
    /// </summary>
    string? WorkerId { get; }

    /// <summary>
    /// The time when the lock expires
    /// </summary>
    DateTime? LockExpirationTime { get; }
}